<?
/**
 * DEPRECATED
 */
include('../controller/handler.php');

$hd = new Handler();

$adds = (int)$_GET['adds'];

if($adds>=0) {
	$perc = 1;
	$msg = sprintf("<b>%s</b> tags added", ($adds==0)? "No" : $adds);
} elseif($adds==-1) {
	$perc = (time()-$hd->getLastTimestamp())/$hd->getTimeOut();
	if($perc<1) {
		$msg = "Wait <b>".($hd->getTimeOut()-(time()-$hd->getLastTimestamp()))."</b> seconds to update again";
	} else {
		$msg = "You can refresh the page now";
	}
} elseif($adds==-2) {
	$perc = (time()-$hd->getLastExceedingRequest())/$hd->getTwitterRateLimit();
	$min = floor(($hd->getTwitterRateLimit()-(time()-$hd->getLastExceedingRequest()))/6)/10;
	$msg = "Twitwords exceeded rate limit, wait <b>$min</b> minutes and try again";
}

$value = 500*$perc;

header("Content-type: text/xml;charset=ISO-8859-1");
echo "<xml>";
echo "<value>$value</value>";
echo "<message><![CDATA[$msg]]></message>";
echo "</xml>";
?>